// 创建路由 并暴露

// 引入createRouter
import { createRouter, createWebHistory } from "vue-router";
// 引入要呈现的组件
import ABOUT from "@/pages/ABOUT.vue";
import NEWS from "@/pages/NEWS.vue";
import HOME from "@/pages/HOME.vue";
import Detail from "@/pages/Detail.vue";
// 创建路由
const router = createRouter({
  history: createWebHistory(), //工作模式
  routes: [
    {
      name: "zhuye",
      path: "/home",
      component: HOME,
    },
    {
      name: "xinwen",
      path: "/news",
      component: NEWS,
      children:[
        {
            name:'xiang',
            // 子级不需要写斜杠
            path:'detail',
            component:Detail,
        }
      ]
    },
    {
      name: "guanyu",
      path: "/about",
      component: ABOUT,
    },
  ],
});
// 将router暴露出去
export default router;
